#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
#include <functional>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<int, PII> PIII;
typedef pair<LL, int> PLI;
typedef pair<int, LL> PIL;
#define x first
#define y second
int dx[8] = {0,0,1,-1,1,1,-1,-1}, dy[8] = {1,-1,0,0,1,-1,1,-1};
#define lowbit(x) (x & (-x))
const int inf = 0x3f3f3f3f;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int mod = 998244353;
const int N = 100010;
int a[N], t[N], b[N], n;
LL pre[N], c[N];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++)
{
cin >> t[i];
pre[i] = pre[i - 1] + t[i];
}
for (int i = 1; i <= n; i++)
{
int l = i, r = n;
while (l < r)
{
int mid = l + r >> 1;
if (pre[mid] - pre[i - 1] >= a[i]) r = mid;
else l = mid + 1;
}
b[i] += b[i - 1];
b[i] ++, b[l] --;
c[l] += min((LL)t[l], a[i] - (pre[l - 1] - pre[i - 1]));
}
for (int i = 1; i <= n; i++) cout << 1LL * b[i] * t[i] + c[i] << ' ';
return 0;
}
1486B - Eastern Exhibition | 1363A - Odd Selection |
131B - Opposites Attract | 490C - Hacking Cypher |
158B - Taxi | 41C - Email address |
1373D - Maximum Sum on Even Positions | 1574C - Slay the Dragon |
621A - Wet Shark and Odd and Even | 1395A - Boboniu Likes to Color Balls |
1637C - Andrew and Stones | 1334B - Middle Class |
260C - Balls and Boxes | 1554A - Cherry |
11B - Jumping Jack | 716A - Crazy Computer |
644A - Parliament of Berland | 1657C - Bracket Sequence Deletion |
1657B - XY Sequence | 1009A - Game Shopping |
1657A - Integer Moves | 230B - T-primes |
630A - Again Twenty Five | 1234D - Distinct Characters Queries |
1183A - Nearest Interesting Number | 1009E - Intercity Travelling |
1637B - MEX and Array | 224A - Parallelepiped |
964A - Splits | 1615A - Closing The Gap |